#ifndef CONNECT_WINDOW_H_
#define CONNECT_WINDOW_H_

#include <Elementary.h>
#include <string>
#include <iostream>
#include "popen_wrapper.h"
#include "Network.h"

const std::string CONNECT_STRING = "Connecting to ";

class ConnectWindow
{
public:
	ConnectWindow(Evas_Object* parent, const Network* nw);
	~ConnectWindow();
	
	void Connect();
	void ConnectSuccess(std::string ip_address);
	
	std::string ESSID() const {return the_nw.Name();}
	std::string PSK() const {return the_nw.PSK();}
	
	void ESSID(const char* _essid) {the_nw.Name(_essid);}
	void PSK(const char* _psk) {the_nw.PSK(_psk);}
	
private:
	Evas_Object* inwin, * persistent_frame, * vb, * hb, * pad, * pad2, * lbl, * ok_bt, * cancel_bt, * quit_bt, * entry, * output;
	Network the_nw;
};

int clean_interface(void* output);
int generate_wpa_supplicant(void* output);
int run_wpa_supplicant(void* output);
int run_udhcpc(void* output);

#endif
